package file;

import java.io.File;
import java.io.IOException;


/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/6
 **/
public class CreatNewFileDemo {
    public static void main(String[] args) throws IOException {
        for (int i = 0; i < 10; i++) {
            File file = new File("./"+(i+1)+"text.txt");
            if (file.exists()){
                System.out.println("文件已存在");
            }else {
                file.createNewFile();
                System.out.println("文件text"+(i+1)+"已创建");
            }
        }





















        /*
        File file = new File("./text.txt");
        if (file.exists()){
            System.out.println("文件存在");
        }else {
            file.createNewFile();
            System.out.println("文件已创建");
        }\

         */
    }
}
